package com.hellpro.lolbox.video.model;

import com.hellpro.lolbox.video.bean.VideoSelectionVpBean;
import com.youth.banner.Banner;
import com.youth.banner.BannerConfig;

import java.util.ArrayList;
import java.util.List;

/**
 * 类描述:
 * 创建人:阿犇
 * 创建时间:2016/10/20
 * 备注:精选页面处理图片轮播的类
 */

public class VideoSelectionVpAdapter {

    private List<VideoSelectionVpBean> mList;
    private Banner mBanner;
    public VideoSelectionVpAdapter(List<VideoSelectionVpBean> list,Banner banner){
        this.mList = list;
        this.mBanner = banner;
    }
    public void setVpAdapter(){
        List<String> imgUrl = new ArrayList<>();
        for (int i = 0; i < mList.size(); i++) {
            String host_pic = mList.get(i).getPic_ad_url();
            imgUrl.add(host_pic);
        }
        //设置图片轮播显示小圆点
        mBanner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR);
        //设置图片的轮播速度
        mBanner.setDelayTime(3000);
        //设置小圆点的位置
        mBanner.setIndicatorGravity(BannerConfig.CENTER);
        //设置加载图片的网址和加载方式
        mBanner.setImages(imgUrl);
        /*mBanner.setOnBannerClickListener(new Banner.OnBannerClickListener() {
            @Override
            public void OnBannerClick(View view, int position) {
                HomeSelectionBean.SlideBean slideBean = mSlide.get(position-1);
                //获取点击图片的网址
                String itemtype = mSlide.get(position - 1).getItemtype();
                //itemtype:根据跳转页面的不同 ，判断跳转到webview还是活动页面
                //TODO:跳转到活动页面
                if ("event".equals(itemtype)){
                    String hand_id = slideBean.getHand_id();
                    Intent intent = new Intent(mContext, HomeEventDetailActivity.class);
                    intent.putExtra("c_id",hand_id);
                    mContext.startActivity(intent);

                }else {
                    //跳转到webView
                    String handUrl = slideBean.getHand_id();
                    Intent intent = new Intent(mContext, VpInfoActivity.class);
                    intent.putExtra("url",handUrl);
                    mContext.startActivity(intent);
                }

            }
        });*/
    }

}
